home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / LK_V1.06.LHA / LK V1.06 / HELP / nodataoverlaid.hlp < prev    next >
Encoding:
INI File  |  1994-11-01  |  2.9 KB  |  122 lines

  1. [LANGUAGE english; PARENT keywords; PAGE 11-62]
  2. [C;6;B]        NODATAOVERLAID
  3. [7]Default: data in overlay are allowed
  4. [J;1;N]
  5.   Only the commercial version will have this instruction fully \
  6. supported. Registred people will receive that version.
  7.  
  8.   This instruction will suppress any DATA or BSS hunk from \
  9. overlaid units. This is useful when you do not want to know \
  10. how DATA and BSS hunks are managed. Note that you still \
  11. have to forget the usage of any kind of data within your \
  12. hunks of code (except for case tables or that kind of \
  13. 'code' things.)
  14.   This instruction is useless on executable files. Those \
  15. files are supposed functional and cannot be changed.
  16.  
  17.   In one way this is not the most intelligent usage of \
  18. overlaid program. But your C may not give you a choice.
  19.  
  20.   Example of code:
  21.  
  22.  
  23.   This first example will need the NODATAOVERLAID:
  24. [5]
  25.     char *getdefaultstring()
  26.     {
  27.         return ("I am the default string");
  28.     }
  29. [INDENT 4; 2]
  30.     using a compilation mode which forbid strings \
  31. to be compiled within the code hunk.
  32. [INDENT; 1]
  33.   or
  34. [5]
  35.       section text,code
  36.  
  37.     getdefaultstring:
  38.       move.l #defaultstring,d0
  39.       rts
  40.  
  41.       section data,data
  42.  
  43.     defaultstring:
  44.       dc.b "I am the default string",0
  45. [1]
  46.   This second example is not a valid overlay object:
  47. [5]
  48.     char *getdefaultstring()
  49.     {
  50.         return ("I am the default string");
  51.     }
  52. [INDENT 4; 2]
  53.     using a compilation mode which forces strings to be \
  54. compiled within the code hunk.
  55. [INDENT; 1]
  56.   or
  57. [5]
  58.       section text,code
  59.  
  60.     getdefaultstring:
  61.       move.l #defaultstring,d0
  62.       rts
  63.  
  64.     defaultstring:
  65.       dc.b "I am the default string",0
  66. [1]
  67.   Note: in both cases the function is suppositivly called \
  68. from an external hunk. This kind of function may be called \
  69. by the overlaid unit it-self.
  70.  
  71.   This third example shows the best way to do it:
  72. [5]
  73.     char *defaultstr = "I am the default string";
  74.  
  75.     char *getdefaultstring()
  76.     {
  77.         char *s;
  78.         s = malloc(strlen(defaultstr));
  79.         ... /* handle memory errors */
  80.         strcpy(s, defaultstr);
  81.         return (s)
  82.     }
  83. [1]
  84.   or
  85. [5]
  86.     char *defaultstr = "I am the default string";
  87.  
  88.     char *getdefaultstring(char *s) /* s has to be large enough */
  89.     {
  90.         strcpy(s, defaultstr);
  91.         return (s)
  92.     }
  93. [1]
  94.   or
  95. [5]
  96.       section text,code
  97.  
  98.     ;input: a0 as the destination buffer
  99.     getdefaultstring:
  100.       lea     defaultstring,a1
  101.       move.l  a1,d0
  102.     .cpy
  103.       move.b  (a1)+,(a0)+
  104.       bne.b   .cpy
  105.       rts
  106.  
  107.       section data,data
  108.  
  109.     defaultstring
  110.       dc.b "I am the default string",0
  111. [1]
  112.   See also:
  113. [L;3][LINK alv]                ALV
  114. [LINK autooverlay]            AUTOOVERLAY
  115. [LINK filename]                <filename>
  116. [LINK nodataoverlaid]            NODATAOVERLAID
  117. [LINK nospecialdebug]            NOOVLDEBUG
  118. [LINK overlay]                OVERLAY
  119. [LINK overlayobject]            OVERLAYOBJECT
  120. [LINK shortreloc]            SHORTRELOCOVERLAY
  121. [5; LINK about; GOTO address]        Become Registred
  122.